package com.example.baselibrary.utils

import android.content.Context
import java.io.InputStream


/**
 * Created by yechaoa on 2020/2/4.
 * Describe : 配置文件
 */
object MyConfig {
    const val COOKIE = "cookie"

    //    const val endpoint = BuildConfig.SERVER_URL
    const val endpoint = ""

    /**
     * 读取acc
     */
    fun getAssetsFile(fileName: String, context: Context): String {
        val stringBuilder = StringBuilder()
        var inputStream: InputStream? = null
        try {
            val assetManager = context.assets
            inputStream = assetManager.open(fileName)
            val available = inputStream.available()
            val bytes = ByteArray(available)
            if (inputStream.read(bytes) > 0) {
                val result = String(bytes)
                stringBuilder.append(result)
            }
        } catch (e: Exception) {
            e.printStackTrace()
        }finally {
            if (inputStream != null) {
                inputStream.close()
            }
        }
        return stringBuilder.toString()
    }

}